# -*- coding: utf-8 -*-


from addEmployee import *


def login(userNumber):
    url = get_url('login')
    headers = get_headers('login')
    data = get_data('login')
    data['userNumber']=userNumber
    expect = get_expect('login')
    ree = send_requests('login', url, data, headers)
    a1 = json.loads(ree.text)

    token = a1['data']['token']
    return token
def increaseReport(name,phone,email,userNumber):
    token = login(userNumber)
    url=get_url('increaseReport')
    headers=get_headers('increaseReport')
    headers['Authorization'] = token
    data = get_data('increaseReport')
    data['candidateName']=name
    data['phone']=phone
    data['email']=email
    ree = send_requests('increaseReport', url, data, headers)
    a1 = json.loads(ree.text)
    assert a1['data']=='新增成功'
    print('报备成功！')

if __name__=="__main__":
    tup = test_employee_entry().ready_('154')
    name = tup[0]
    phone = tup[1]
    email = phone + '@139.com'
    userNumber="12401"
    print(name, phone, email)
    increaseReport(name,phone,email,userNumber)


